package com.hnas.core.service;

import java.util.Collection;
import java.util.List;

import javax.persistence.EntityManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;

import com.hnas.core.dao.IBaseHibernateDAO;
import com.hnas.core.dao.PageBean;


/**
 * @author zybluesky
 *
 */
@Component("baseService")
public  class BaseService implements IBaseService{
	@Autowired
	private IBaseHibernateDAO baseDao;
public void setBaseDao(IBaseHibernateDAO baseDao) {
		this.baseDao = baseDao;
	}

public Object findByID(Class clazz, Long id){
	return baseDao.findByID(clazz, id);
}
public Object findByID(Class clazz, Integer id){
	return baseDao.findByID(clazz, id);
}

public Object saveOrUpdate(Object obj){
	return baseDao.saveOrUpdate(obj);
}
public Object saveOrUpdatef(Object obj){
	return baseDao.saveOrUpdatef(obj);
}
	//	��ҳ��ѯ
	public void queryByPage(PageBean page, String hql, Object[] paras) throws DataAccessException, Exception{
		baseDao.queryByPage(page, hql, paras);
	}
	
	public void delete(Object o) {
		baseDao.delete(o);
	}
	public Collection saveOrUpdateAll(Collection c) {
		return baseDao.saveOrUpdateAll(c);
	}
	

	
	public List getList(String hql, Object ob2[]){
		return baseDao.getList(hql, ob2);
	}

	public EntityManager getEntityManager() {
		// TODO Auto-generated method stub
		return baseDao.getEntityManager();
	}
	

	public void update(Object obj) {
		// TODO Auto-generated method stub
		this.baseDao.update(obj);
	}

	public void updateAll(Collection c) {
		// TODO Auto-generated method stub
		this.baseDao.updateAll(c);
	}
	
}
